package wjh.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import wjh.pojo.Doctor;
import wjh.pojo.Plan;
import wjh.pojo.Records;

import java.util.List;

@Repository
public interface DoctorMapper {
    List<Doctor> findDoctorsKe();
    @Select("SELECT d.name,dp.department_name FROM doctor AS d \n" +
            "INNER JOIN department AS dp ON d.department_id=dp.id")
    List<Doctor> findDoctors2();

    @Update("update plan set doctor_id=#{doctor_id},number=#{number},week=#{week} where id=#{id}")
    void updatePaiBan(Plan plan);

    @Select("select * from records")
    List<Records> findAllRecord();
    //    通过param注解声明参数key
    List<Records> findAllRecordsLike(@Param("likeName") String likeName);

    @Select("select * from records where id=#{value}")
    Records findRecordById(Integer id);

    @Insert("INSERT INTO records VALUES(NULL,#{records_number},#{doctor_name},#{user_name},\n" +
            "#{user_sex},#{user_age},#{date},#{orders},#{status},#{deleted},#{seek},#{doctor_id},#{patient_id})")
    void addRecords(Records records);
}


